﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FooFun.Web.Controls;
using AccessGrant.GrantFrameworks;
using FooFun.DataElements.Dtos;
using DTOFrameworks;
using FAQFrameworks;

namespace FooFun.Web.Controls
{
    public class LinkRemoveFix : DataElementControl
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //PermissionQuery query = PermissionQuery.Create();
            //RoleSetQuery roleSetQuery = RoleSetQuery.Create();

            //IDataElement de = roleSetQuery.GetRoleOfUserInForum(
            //    FAQContext.Current.User.AccountId,
            //    FAQContext.Current.ForumId);

            //if (!de["RoleId"].IsEmpty)
            //{
            //    IEnumItem role
            //        = query.GetAccountById((Guid)de["RoleId"].Value);

            //    if (role.Name == "版主" || role.Name == "系统管理员")
            //    {
            //        this.ShowContent("Normal");

            //        return;
            //    }
            //}

            //this.ShowContent("Empty");

            this.Visible = false;
            if (FAQContext.Current.User.IsInRole("系统管理员")
                || FAQContext.Current.User.IsInRole("版主"))
            {

                this.Visible = true;
            }
        }
    }
}
